import React from 'react'
import ReactDOM from 'react-dom/client'
import Router from './router'
import cache from './utils/localStore'
// rem基准值计算
// yarn add amfe-flexible
import 'amfe-flexible'
// 过渡动画
import 'animate.css'
import './style/animate_var.css'
import './style/transition.css'
// 重置样式
import './style/reset.css'

// 路由
import { BrowserRouter } from 'react-router-dom'

// redux
import { Provider } from 'react-redux'
import store from './store'

// 持久化处理
if(cache().has('user')){
  store.dispatch({ type: 'uesr/setUserinfo', payload: cache().get('user') })
}

// 引入antd-mobile的样式
// 完整引入
// import 'antd-mobile/dist/antd-mobile.css'
// 按需引入
// import 'antd-mobile/lib/button/style/css'
// import 'antd-mobile/lib/white-space/style/css'

const root = ReactDOM.createRoot(document.getElementById('root'))
root.render(
  <Provider store={store}>
    <BrowserRouter>
      <Router />
    </BrowserRouter>
  </Provider>
)
